<?php

/*

Explore (explore.php)

*/

$page_title = "Explore";
$rank_check = 1;
include "header.inc.php";

$findLocation = fetch("SELECT * FROM current_locations WHERE userid = '$userid' AND game = '$game'");

if (!$findLocation[id])
{
	mysql_query("INSERT INTO current_locations (userid,x_loc,y_loc,game) VALUES ('$userid','1','1','$game')");
	$findLocation = fetch("SELECT * FROM current_locations WHERE userid = '$userid' AND game = '$game'");
}

print "$openHTML<CENTER><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=300 HEIGHT=300>";

for ($x = $findLocation[x_loc]; $x <= $findLocation[x_loc] + 6; $x++)
{
	print "<TR>";

	for ($y = $findLocation[y_loc]; $y <= $findLocation[y_loc] + 6; $y++)
	{
		$findExpLoc = fetch("SELECT * FROM explore_locations WHERE game = '$game' AND x_loc = '$x' AND y_loc = '$y'");
		$findTileType = fetch("SELECT * FROM tile_types WHERE id = '$findExpLoc[tile_type]' AND game = '$game'");

		$blah = "$findExpLoc[x_loc]$findExpLoc[y_loc]";
		$show[$blah] = "images/user_images/opg_$game/tiles/tile_$findTileType[id].gif";

		if (!$findTileType[id])
		{
			$show[$blah] = "images/explore/black_tile.gif";
		}

		print "<TD BACKGROUND=$show[$blah]><P>&nbsp;</P></TD>";
	}
	print "</TR>";
}
print "</TABLE></CENTER>$closeHTML";

?>